package chapter18.tankwar;


/**
 * @Auther: Tx
 * @Date: 2022/5/28 18:39
 */
public class myTank extends Tank {
    Bullet bullet = null;

    public myTank(int x, int y) {
        super(x, y);
    }

    //射击方法
    public void shot() {
        switch (getDirection()) {
            case 0://向上开火
                bullet = new Bullet(getX() + 20, getY(), 0);
                break;
            case 1:
                bullet = new Bullet(getX() + 60, getY() + 20, 1);
                break;
            case 2:
                bullet = new Bullet(getX()+20,getY()+60,2);
                break;
            case 3:
                bullet = new Bullet(getX(),getY()+20,3);
                break;
        }
        //启动线程
        new Thread(bullet).start();
    }

}
